#ifndef PWM_S5_CONTROLLER_H
#define PWM_S5_CONTROLLER_H
#include <Arduino.h>
#include "Scheduler.h"
#include "I2CSlave.h"
#include "DataStorage.h"
#include "PwmS5.h"
#include "lwmp.h"
class PwmS5Controller : public Scheduler
{
public:

typedef enum
{
    SW = 0,
    PWM =1
}PinOutMode;

typedef enum
{
    Close = 0,
    Open =1
}PinState;

typedef enum
{
    Select = 0,
    Customize =1
}FreqMode;

PwmS5Controller(I2CSlave& i2c_slave,DataStorage& _dataStorage,PwmS5& pwmS5);
~PwmS5Controller();

void begin();
void schedule() override;
void update() override;
void cleanup()override;

void update_pwm_fixed_freq(PwmOut& pwmout,uint8_t freq_num,float duty_cycle);
void apply_setup_update(module_general_reg_t& module_general_reg,module_general_info_t& info);
private:

I2CSlave& _i2c_slave;
DataStorage& _dataStorage;
PwmS5& _pwmS5;
bool _isr_update;
// uint8_t _cmd_data[6];
CircularBuffer<uint8_t,32> _cb_read_reg;
CircularBuffer<uint8_t,32> _cb_write_reg;

//module_status_number_reg_t _module_status_number_reg;

os::memory_pool_t::memory_node_t _reg_data_read;
};


#endif